home *** CD-ROM | disk | FTP | other *** search
- Path: lyra.csx.cam.ac.uk!nmm1
- From: nmm1@cus.cam.ac.uk (Nick Maclaren)
- Newsgroups: comp.std.c
- Subject: Re: EXIT_SUCCES != EXIT_FAILURE?
- Date: 28 Mar 1996 10:52:05 GMT
- Organization: University of Cambridge, England
- Message-ID: <4jdr0l$ddn@lyra.csx.cam.ac.uk>
- References: <tompa.827763954@news> <4j7p4p$4n8@castle.nando.net>
- NNTP-Posting-Host: ursa.cus.cam.ac.uk
-
- In article <4j7p4p$4n8@castle.nando.net>, actuary@nando.net (Bill McCarthy) writes:
- |> In <tompa.827763954@news>, tompa@ida.liu.se (Thomas Padron-McCarthy) writes:
- |> >
- |> >Many of the students in a C course I teach have started to use
- |> >EXIT_SUCCESS and EXIT_FAILURE as return values from functions
- |> >(other than main).
- |> >
- |> >I don't like this new practice, but questions of style are difficult.
- |> >So I wonder: Does the standard guarantee that EXIT_SUCCESS and
- |> >EXIT_FAILURE are different?
- |>
- |> Not only are they not guaranteed to be different. EXIT_SUCCESS is
- |> not guaranteed to be zero, and EXIT_FAILURE is not guaranteed to
- |> be different from 0. They are implementation defined and should
- |> only be used as an argument to exit() or in a return from main().
-
- This is a little harsh. While they are not defined to be different,
- they will be the same only on a very inferior implementation indeed!
- And few students are capable of writing code that can defend itself
- against such implementations.
-
- Also, if they use them CONSISTENTLY, it doesn't matter that their
- values are not defined. I would regard this practice as perfectly
- reasonable, in context, though I have no intention of adopting it
- myself.
-
- To put things in context, do you expect all students to write code
- assuming the compilation and execution environments differ in their
- character sets and both fixed- and floating-point arithmetic?
-
-
- Nick Maclaren,
- University of Cambridge Computer Laboratory,
- New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
- Email: nmm1@cam.ac.uk
- Tel.: +44 1223 334761 Fax: +44 1223 334679
-